#!/usr/bin/env bash
# deepdive-redo -- Runs processes after marking them as 'todo'
# > deepdive redo TARGET...
##
set -eu

. deepdive-do-getopts.sh
[[ $# -gt 0 ]] || usage "$0" "No TARGET to redo given"

deepdive-mark todo "$@"
onexit() {
    # restore timestamps if needed
    case $? in
        130)  # when deepdive-do was canceled
            deepdive-mark restore "$@"
            ;;
    esac
}
trap 'onexit "$@"' EXIT
deepdive-do "$@"
